//
//  HNNewsDetailModel.m
//  HappyNews
//
//  Created by Sai on 16/1/9.
//  Copyright © 2016年 bai wang. All rights reserved.
//

#import "HNNewsDetailModel.h"
#import "HNNewsDetailEditorsModel.h"
#import "HNNewsDetailStories.h"
@implementation HNNewsDetailModel

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    if ([key isEqualToString:@"description"]) {
        _Description = value;
    }
}

- (void)setValue:(id)value forKey:(NSString *)key
{
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"editors"]) {
        NSMutableArray *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            HNNewsDetailEditorsModel *model = [[HNNewsDetailEditorsModel alloc]init];
            [model setValuesForKeysWithDictionary:dic];
            [array addObject:model];
        }
        _editors = [NSArray arrayWithArray:array];
    }
    
    if ([key isEqualToString:@"stories"]) {
        NSMutableArray *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            HNNewsDetailStories *model = [[HNNewsDetailStories alloc]init];
            [model setValuesForKeysWithDictionary:dic];
            [array addObject:model];
        }
        _stories = [NSArray arrayWithArray:array];
    }
    
    
}


@end
